<?php
require('connect_sql.php');
require('function.php');
session_start();
if(isset($_SESSION['userid']))
{
	$power=getdataf('power','usertable','userid',$_SESSION['userid']);
	if($power==3)
	{
		if(isset($_REQUEST)){
			if($_REQUEST['action']==1)
			{
				checkintable($_REQUEST['ruserid']);
				deletef('userapply','userid',$_REQUEST['ruserid']);
				echo "处理成功";
			}
			else if($_REQUEST['action']==2)
			{
				deletef('userapply','userid',$_REQUEST['ruserid']);
				echo "处理成功";
			}
			else if($_REQUEST['action']==3)
			{
				
				$mpassword=md5('123456');
				updatef('usertable','password',$mpassword,'userid',$_REQUEST['ruserid']);
				echo "处理成功";
			}
			else if($_REQUEST['action']==4)
			{
				deletef('usertable','userid',$_REQUEST['ruserid']);
				echo "处理成功";
			}
			else
			{
				echo "该功能未开放";
			}
		}
	}
	else echo "您的权限不够";
}
else
{
	echo "请登陆";
}


//审核
function checkintable($ruserid){
	$mpassword=md5('123456');
	mysql_query('set names utf8');
	$user=getdataall('userapply','userid',$ruserid);
	$query="insert into usertable(userid,username,password,classid,email,phone) 
	values('".$user['userid']."','".$user['username']."','".$mpassword."','".$user['classid']."','".$user['email']."','".$user['phone']."')";
	mysql_query($query) or die(mysql_error());
	return 1;
}
?>